Socket
Socket
Sign inDemoInstall

@types/semver

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/semver

TypeScript definitions for semver


Version published
Weekly downloads
23M
increased by6.07%
Maintainers
1
Weekly downloads
 
Created

What is @types/semver?

The @types/semver package provides TypeScript type definitions for the semver package, which is a utility for handling semantic versions. It allows developers to parse, compare, and manipulate semantic versions in TypeScript projects with type safety.

What are @types/semver's main functionalities?

Parsing a version

This feature allows you to parse a semantic version string and access its components, such as the major, minor, and patch versions.

"import semver from 'semver';\nconst version = semver.parse('1.2.3');\nconsole.log(version.major); // 1"

Comparing versions

This feature enables you to compare two semantic version strings and determine their order.

"import semver from 'semver';\nconst result = semver.compare('1.2.3', '1.2.4');\nconsole.log(result); // -1"

Satisfying ranges

This functionality allows you to check if a semantic version satisfies a given version range.

"import semver from 'semver';\nconst satisfied = semver.satisfies('1.2.3', '^1.0.0');\nconsole.log(satisfied); // true"

Other packages similar to @types/semver

FAQs

Package last updated on 24 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc